# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         items和keys方法
# Description:
# Author:       asus
# Date:         2019/3/6
#-------------------------------------------------------------------------------


#定义一个字典
dict = {"help":"帮助","bike":"自行车","geek":"极客","China":"中国"}
#在控制台输出所有的key-value对
print(dict.items())
#通过for循环对dict中的所有值进行迭代
for key_value in dict.items():
    print("key","=",key_value[0],"value","=",key_value[1])
#判断("bike","自行车")是否在items的返回值里面
print(("bike","自行车") in dict.items())
#获取key-value对
dict_items = dict.items()
#修改字典里面的值
dict["bike"] = "自行车，摩托车，电动自行车"
#dict_items里面的值也会跟随改变
print(dict_items)


#输出字典中的所有key
print(dict.keys())
#迭代
for key in dict.keys():
    print(key)